﻿@namespace BlazorComponent
@using BlazorComponent.Helpers
@inherits BDomComponentBase

<CascadingValue Value="IsDark" Name="IsDark">
    <IfTransitionElement
        Tag="@Tag"
        Value="@If"
        Class="@CssProvider.GetClass()"
        Style="@CssProvider.GetStyle()"
        ReferenceCaptureAction="_ => Ref = _"
        type="@(OnClick.HasDelegate ? "button" : null)"
        __internal_stopPropagation_onmouseup="@OnMouseupStopPropagation"
        __internal_preventDefault_onmouseup="@OnMouseupPreventDefault"
        @attributes="@Attributes">
        @if (ComputedIcon is { IsSvg:true })
        {
            <svg class="@CssProvider.GetClass("svg")"
                 style="@CssProvider.GetStyle("svg")"
                 xmlns="http://www.w3.org/2000/svg"
                 @attributes="@SvgAttrs">
                @foreach (var path in ComputedIcon.GetSvgPaths())
                {
                    <path d="@path.D" @attributes="@path.Attributes">
                    </path>
                }
            </svg>
        }
        else
        {
            @ComputedIcon?.AsT0
        }
    </IfTransitionElement>
</CascadingValue>
